﻿using System.Collections.Generic;
using Engine;
using Engine.Graphics;
using Game;

namespace Mekiasm
{
    public class RubberLeaves : ItemCube
    {
        public static int Index;

        public RubberLeaves() : base( "橡胶树叶")
        {
            
        }
        
        public override int GetFaceTextureSlot(int face, int value)
        {
            return 132;
        }
        
        public override void GetDropValues(SubsystemTerrain subsystemTerrain, int oldValue, int newValue, int toolLevel, List<BlockDropValue> dropValues, out bool showDebris)
        {
            showDebris = true;
            if (ILibrary.random.Bool(0.01f))
            {
                dropValues.Add(new BlockDropValue() { Value = RubberSapl.Index, Count = 1 });
            }
        }
        public override string GetSoundMaterialName(SubsystemTerrain subsystemTerrain, int value)
        {
            return BlocksManager.Blocks[BirchLeavesBlock.Index].DefaultSoundMaterialName;
        }
        public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
        {
            BlocksManager.DrawCubeBlock(primitivesRenderer, value, new Vector3(size), ref matrix, Color.DarkGreen, Color.DarkGreen, environmentData);
        }
        public override bool IsFaceTransparent(SubsystemTerrain subsystemTerrain, int face, int value)
        {
            return true;
        }
        public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            generator.GenerateCubeVertices(block, value, x, y, z, Color.DarkGreen, geometry.AlphaTestSubsetsByFace);
        }
    }
}
